package com.xuecheng.content.api;

import com.xuecheng.base.exception.ValidationGroups;
import com.xuecheng.content.model.po.CourseCategory;
import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: 师资管理相关接口
 * @author: ajie
 * @date: 2024/1/16 10:07:13
 * @version: 1.0
 */
@Api(value = "师资管理相关接口",tags = "师资管理相关接口")
@RestController
public class CourseTeacherController {
    @Autowired
    CourseTeacherService courseTeacherService;

    /**
     * @description: 查询教师接口 
     * @params: [courseId]       
     * @return: 
     * @author: ajie
     * @date: 2024/1/16 10:40
     */
    @ApiOperation("查询教师接口")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> queryCourseTeacherList(@PathVariable Long courseId){
        return courseTeacherService.queryCourseTeacherList(courseId);
    }

    /**
     * @description: 添加与修改教师接口
     * @params: [courseTeacher]
     * @return:
     * @author: ajie
     * @date: 2024/1/16 10:43
     */
    @ApiOperation("添加与修改教师接口")
    @PostMapping("/courseTeacher")
    public CourseTeacher saveCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        //机构id，由于认证系统没有上线暂时硬编码
        Long companyId = 1232141425L;
        return courseTeacherService.saveCourseTeacher(companyId,courseTeacher);
    }

    /**
     * @description: 删除课程教师
     * @params: [courseId, teacherId]       
     * @return: 
     * @author: ajie
     * @date: 2024/1/16 13:27
     */
    @ApiOperation("删除课程教师")
    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public void deleteCourseTeacher(@PathVariable Long courseId,@PathVariable Long teacherId){
        //机构id，由于认证系统没有上线暂时硬编码
        Long companyId = 1232141425L;
        courseTeacherService.deleteCourseTeacher(companyId,courseId,teacherId);
    }
}
